<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <script src="./vue/dist/vue.js"></script>
</head>

<body>
  <div id="app">
    {{msg}}
    <button @click="count++">按钮 {{count}}</button>
  </div>

  <script>
    // 生命周期 8个
    const vm = new Vue({
      el: "#app",
      data: {
        count: 1,
        msg: "信息"
      },
      // 创建
      beforeCreate() {
        console.log("-------------beforeCreate-----------")
        console.log(this.$el)
        console.log(this.$data)
        console.log(this.msg)
      },

      // 挂载
      beforeMount() {
        console.log("-------------beforeMount-----------")
        console.log(this.$el)
        console.log(this.$data)
        console.log(this.msg)
      },
      mounted() {
        console.log("-------------mounted-----------")

        console.log(this.$el)
        console.log(this.$data)
        console.log(this.msg)
      },
      //更新
      beforeUpdate() {
        console.log("-------------beforeUpdate-----------")

        console.log(this.$el)
        console.log(this.$data)
        console.log(this.msg)
      },
      updated() {
        console.log("-------------updated-----------")
        console.log(this.$el)
        console.log(this.$data)
        console.log(this.msg)
      },

      // 注销
      beforeDestroy() {
        console.log("-------------beforeDestroy-----------")
        console.log(this.$el)
        console.log(this.$data)
        console.log(this.msg)
      },
      destroyed() {
        console.log("-------------destroyed-----------")
        console.log(this.$el)
        console.log(this.$data)
        console.log(this.msg)
      },
      created() {
        console.log("-------------created-----------")
        console.log(this.$el)
        console.log(this.$data)
        console.log(this.msg)
      },

    })

    // vm.$destroy()
  </script>
</body>

</html>
